<div class="task">
<?php include ('buttons.tpl'); ?>
</div>
<?php if ($error) { ?>
<div class="warning"><?php echo $error; ?></div>
<?php } ?>
<h2><?php echo $heading_title; ?></h2>
<div class="description"><?php echo $heading_description; ?></div>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  <div id="tabs">
	<ul>
	  <li><a href="#tabs-1"><?php echo $tab_general; ?></a></li>
	  <li><a href="#tabs-2"><?php echo $tab_data; ?></a></li>
	</ul>
	<div id="tabs-1">
      <?php foreach ($coupons as $coupon) { ?>
      <fieldset>
        <legend><?php echo $coupon['language']; ?></legend>
        <table>
          <tr>
            <td width="185"><span class="required">*</span> <?php echo $entry_name; ?></td>
            <td><input name="language[<?php echo $coupon['language_id']; ?>][name]" value="<?php echo $coupon['name']; ?>" />
              <?php if ($error_name) { ?>
              <span class="error"><?php echo $error_name; ?></span>
              <?php } ?></td>
          </tr>
          <tr>
            <td valign="top"><span class="required">*</span> <?php echo $entry_description; ?></td>
            <td><textarea name="language[<?php echo $coupon['language_id']; ?>][description]" cols="40" rows="5" id="description<?php echo $coupon['language_id']; ?>"><?php echo $coupon['description']; ?></textarea>
              <?php if ($error_description) { ?>
              <span class="error"><?php echo $error_description; ?></span>
              <?php } ?></td>
          </tr>
        </table>
      </fieldset>
      <?php } ?>
    </div>
  	<div id="tabs-2">
      <table>
        <tr>
          <td width="185"><span class="required">*</span> <?php echo $entry_code; ?></td>
          <td><input type="text" name="code" value="<?php echo $code; ?>" />
            <?php if ($error_code) { ?>
            <span class="error"><?php echo $error_code; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_discount; ?></td>
          <td><input type="text" name="discount" value="<?php echo $discount; ?>" /></td>
        </tr>
        <tr>
          <td><?php echo $entry_prefix; ?></td>
          <td><select name="prefix">
              <?php if ($prefix != '-') { ?>
              <option value="%" selected="selected"><?php echo $text_percent; ?></option>
              <option value="-"><?php echo $text_minus; ?></option>
              <?php } else { ?>
              <option value="%"><?php echo $text_percent; ?></option>
              <option value="-" selected="selected"><?php echo $text_minus; ?></option>
              <?php } ?>
            </select></td>
        </tr>
        <tr>
          <td><?php echo $entry_shipping; ?></td>
          <td><?php if ($shipping) { ?>
            <input type="radio" name="shipping" value="1" checked="checked" />
            <?php echo $text_yes; ?>
            <input type="radio" name="shipping" value="0" />
            <?php echo $text_no; ?>
            <?php } else { ?>
            <input type="radio" name="shipping" value="1" />
            <?php echo $text_yes; ?>
            <input type="radio" name="shipping" value="0" checked="checked" />
            <?php echo $text_no; ?>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_date_start; ?></td>
          <td><input name="date_start_day" value="<?php echo $date_start_day; ?>" size="2" maxlength="2" />
            <select name="date_start_month">
              <?php foreach ($months as $month) { ?>
              <?php if ($month['value'] == $date_start_month) { ?>
              <option value="<?php echo $month['value']; ?>" selected="selected"><?php echo $month['text']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $month['value']; ?>"><?php echo $month['text']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>
            <input name="date_start_year" value="<?php echo $date_start_year; ?>" size="4" maxlength="4" />
            <?php if ($error_date_start) { ?>
            <span class="error"><?php echo $error_date_start; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_date_end; ?></td>
          <td><input name="date_end_day" value="<?php echo $date_end_day; ?>" size="2" maxlength="2" />
            <select name="date_end_month">
              <?php foreach ($months as $month) { ?>
              <?php if ($month['value'] == $date_end_month) { ?>
              <option value="<?php echo $month['value']; ?>" selected="selected"><?php echo $month['text']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $month['value']; ?>"><?php echo $month['text']; ?></option>
              <?php } ?>
              <?php } ?>
            </select>
            <input name="date_end_year" value="<?php echo $date_end_year; ?>" size="4" maxlength="4" />
            <?php if ($error_date_end) { ?>
            <span class="error"><?php echo $error_date_end; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_uses_total; ?></td>
          <td><input type="text" name="uses_total" value="<?php echo $uses_total; ?>" /></td>
        </tr>
        <tr>
          <td><?php echo $entry_uses_customer; ?></td>
          <td><input type="text" name="uses_customer" value="<?php echo $uses_customer; ?>" /></td>
        </tr>
        <tr>
          <td valign="top"><?php echo $entry_product; ?></td>
          <td><select name="product[]" multiple="multiple">
              <?php foreach ($products as $product) { ?>
              <?php if ($product['coupon_id']) { ?>
              <option value="<?php echo $product['product_id']; ?>" selected="selected"><?php echo $product['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $product['product_id']; ?>"><?php echo $product['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select></td>
        </tr>
        <tr>
          <td><?php echo $entry_status; ?></td>
          <td><select name="status">
              <?php if ($status) { ?>
              <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
              <option value="0"><?php echo $text_disabled; ?></option>
              <?php } else { ?>
              <option value="1"><?php echo $text_enabled; ?></option>
              <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
              <?php } ?>
            </select></td>
        </tr>
      </table>
    </div>
  </div>
  <script type="text/javascript"><!--
	$(function() {
		$("#tabs").tabs();
	});
  //--></script>
</form>
